cmake_minimum_required(VERSION 3.16)
project(orderkv)

set(CMAKE_CXX_STANDARD 17)
# 在 CMakeLists.txt 文件中添加以下行
#set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -O0")
#SET(CMAKE_BUILD_TYPE Debug)
SET(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -g")

set(MAIN_PATH ${PROJECT_SOURCE_DIR})
configure_file(${CMAKE_CURRENT_SOURCE_DIR}/src/config/default_conf_info.h.in ${CMAKE_CURRENT_SOURCE_DIR}/src/config/default_conf_info.h)

#和源文件不在同一个目录下的头文件需要它，推荐target_include_directories
include_directories(include src)

add_library(qScanDB
        src/orderkv_functions.cpp
        src/cli/command_line.cpp
        src/db/meta_data.cpp
        src/db/server.cpp
        src/lsm_tree/leveldb.cpp
        src/value_store/orderkv_w_buffer.cpp
        src/util/bloom_filter.hpp
        src/config/config_data.cpp
        src/config/config_data.h)
target_include_directories(qScanDB PUBLIC
        src/value_store/orderkv_w_buffer.h
        src/util/lock.hpp
        src/util/thread_pool.hpp
        src/cli/command_line.h
        src/cli/command_parser.hpp
        src/lsm_tree/lsm_tree.h
        src/lsm_tree/leveldb.h
        src/config/conf_parser.hpp
        src/config/conf.hpp
        src/value_store/buffer.h
        src/lsm_tree/RecordVal.h
        src/db/meta_data.h
        src/db/server.h
        ${CMAKE_CURRENT_SOURCE_DIR}/lib/leveldb/include
#        ${CMAKE_CURRENT_SOURCE_DIR}/lib/google_benchmark/include
)
target_link_libraries(qScanDB PUBLIC
        ${CMAKE_CURRENT_SOURCE_DIR}/lib/leveldb/libleveldb.a
#        snappy
#        ${CMAKE_CURRENT_SOURCE_DIR}/lib/google_benchmark/libbenchmark_main.a
#        ${CMAKE_CURRENT_SOURCE_DIR}/lib/google_benchmark/libbenchmark.a
)

add_executable(orderkv src/main.cpp src/bootstrap/bootstrap.cpp)

#add_library(benchmark STATIC IMPORTED)
#set_target_properties(benchmark PROPERTIES IMPORTED_LOCATION ${CMAKE_CURRENT_SOURCE_DIR}/lib/google_benchmark/..)

target_link_libraries(orderkv qScanDB
                              pthread)

#install(TARGETS orderkv DESTINATION /usr/local/lib)
#install(FILES ${headers} DESTINATION /usr/local/include)

add_subdirectory(test/ycsb)